package com.gitee.cirnochat.user.model.vo.req.user;

import com.gitee.cirnochat.user.model.enums.UserStatus;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.NotEmpty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 用户信息更新DTO
 */
@Schema(description = "用户在线状态显示更新DTO")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserOnlineStatusUpdateRequest implements Serializable {
    @Schema(description = "用户在线状态显示")
    @NotEmpty(message = "用户在线状态显示不能为空")
    private UserStatus status;

    @AssertTrue(message = "用户在线状态值非法")
    public boolean isStatusValid() {
        return UserStatus.fromValueStrict(status.getValue()) != null;
    }
}